package cate.game.pvp.ladder.msg;

import cate.common.table.d.GDLadder;
import cate.game.GameBody;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInputTemplate;
import cate.game.client.msg.id.MsgIdBLadder;
import cate.game.pvp.ladder.common.LadderReport;
import cate.game.role.Role;
import cate.game.role.pvp.PvpRecord;
import easy.java.dev.note.NoteField;

import java.util.List;

@ClientMsg(title = "天梯赛 录像 の 请求")
public class LadderReplayReq extends MsgInputTemplate {

    @NoteField(value = "录像类型", detail = "1: 玩家录像(默认) 2: 大神风采")
    public byte type = GDLadder.ReplayType.MINE;

    @Override
    public MsgConfig conf() {
        return MsgIdBLadder.REPLAY_REQ;
    }

    @Override
    public void action(GameBody game, Role role) throws Exception {
        LadderReplayResp resp = new LadderReplayResp();
        resp.type = type;
        List<LadderReport> reports =
                (type == GDLadder.ReplayType.MINE)
                        ? role.getPvp().ladder.reports
                        : role.getGame().pvp.ladder.getMasterReport(GDLadder.REPLAY_SIZE_MAX_DSFC).reports;
        resp.reports = reports;
        resp.sendNow(role);
    }

}
